package cn.vivi.design.prototype;


import java.io.*;
import java.util.Date;

/**
 * 原型对象
 */
public class RealizedType implements Cloneable, Serializable{

    public Date date = new Date(); // -128 127

    public RealizedType() {
        System.out.println("construct");
    }

    @Override
    public RealizedType clone() throws CloneNotSupportedException {
        // 深克隆
        RealizedType clone = (RealizedType) super.clone();
        clone.date = new Date();
        clone.date.setTime(this.date.getTime());
        return clone;
    }
}
